package STUDENT.NGUYENVINH.Array;

public class Modelex1 {

	private double FindAverage(double[] dArray)
	{
	
	double[] sArray;
	
	for (int i=0;i<dArray.length;i++)
	{
		if (dArray[i] >5) {sArray = dArray[i];}  
	}
	return sArray;
	
	System.out.println("sArray[" + i + "] = " "length cua sArray" + sArray.length);	
	
	}

	public static double AverageDouble(double[] dArray)

	{
		double dAverage = 0;
		double sumArray = 0;

		for (int i = 0; i < dArray.length; i++) {

			sumArray += dArray[i];
		}
		return dAverage = sumArray / dArray.length;
	}

	public static double AverageInt(int[] dArray)

	{
		double dAverage = 0;
		double sumArray = 0;

		for (int i = 0; i < dArray.length; i++) {

			sumArray += dArray[i];
		}
		return dAverage = sumArray / dArray.length;
	}

public static int FindMinElement (int[] dArray)
	{
	
	int dMin=0;
	
	for (int i=0;i<dArray.length;i++)
		
	{
		if (dMin <dArray[i]) {dMin = dArray[i];}
	}
	
	return dMin;
	}

}
